import Vue from 'vue'
import VueRouter from 'vue-router'
// import Post from '../components/Post_a_post.vue'
// import Publish from '../components/Publishpictures.vue'
import Home from '../components/Home.vue'

Vue.use(VueRouter)
//解决路由跳转原路由或者刷新出错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

const routes = [
  // {path: '/post', component: () => import('../components/Postapost.vue')},
  { path: '/', component: Home, children: [
      {path: '/', component: () => import('../components/Home_page.vue')},
      {path: '/home_page', component: () => import('../components/Home_page.vue')},
      {path: '/post', component: () => import('../components/Postapost.vue')},
      {path: '/publish', component: () => import('../components/Publishpictures.vue')},
      {path: '/hottopic', component: () => import('../components/Hottopic.vue')},
      {path: '/personalCenter', component: () => import('../components/PersonalCenter/Personalcenterhomepage.vue'), children: [
        {path: '/', component: () => import('../components/PersonalCenter/Post.vue')},
        {path: '/我的发帖', component: () => import('../components/PersonalCenter/Post.vue')},
        {path: '/我的评论', component: () => import('../components/PersonalCenter/Producttheory.vue')},
        {path: '/我的合集', component: () => import('../components/PersonalCenter/Mycollection.vue')},
        {path: '/我的收藏', component: () => import('../components/PersonalCenter/Collection.vue')},
        {path: '/我的粉丝', component: () => import('../components/PersonalCenter/fans.vue')},
        {path: '/我的关注', component: () => import('../components/PersonalCenter/follow.vue')},
        {path: '/隐私设置', component: () => import('../components/PersonalCenter/Privacysettings.vue')},
        {path: '/编辑资料', component: () => import('../components/PersonalCenter/Editdata.vue')}
      ]},
      {path: '/Searchpage', component: () => import('../components/Searchpage.vue'), children: [
        {path: '/', component: () => import('../components/Searchall/searchall.vue')},
        {path: '/Search1', component: () => import('../components/Searchall/searchall.vue')},
        {path: '/Search2', component: () => import('../components/Searchall/Topicsearch.vue')},
        {path: '/Search3', component: () => import('../components/Searchall/Postsearch.vue')},
        {path: '/Search4', component: () => import('../components/Searchall/Usersearch.vue')},
        {path: '/Search5', component: () => import('../components/Searchall/EncyclopediaSearch.vue')},
      ]},
      {path: '/usercenter', component: () => import('../components/Usercenter.vue'), children: [
        {path: '/', component: () => import('../components/UserpersonalCenter/Post.vue')},
        {path: '/发帖', component: () => import('../components/UserpersonalCenter/Post.vue')},
        {path: '/评论', component: () => import('../components/UserpersonalCenter/Producttheory.vue')},
        {path: '/收藏', component: () => import('../components/UserpersonalCenter/Collection.vue')},
        {path: '/粉丝', component: () => import('../components/UserpersonalCenter/fans.vue')},
        {path: '/关注', component: () => import('../components/UserpersonalCenter/follow.vue')}
      ]},
      {path: '/postdetails', component: () => import('../components/Postdetails.vue')},
      {path: '/pub', component: () => import('../components/Pub.vue')},
      {path: '/strategy', component: () => import('../components/Strategy.vue'), children: [
        {path: '/strategy classification', component: ()=> import('../components/Strategy sub route/Strategy classification.vue')}
      ]
    },
      {path: '/official', component: () => import('../components/Official.vue')
    },
      {path: '/observation_pivot', component: () => import('../components/Observation_pivot.vue')},
      {path: '/peer_map/:name', component: () => import('../components/Peer_map.vue')
    },
      {path: '/mycos/:name', component: () => import('../components/Mycos.vue')
    },
      {path: '/follow', component: () => import('../components/Follow.vue')},
      {path: '/news', component: () => import('../components/News/News.vue'), children: [
        {path: '/', component: ()=> import('../components/Message routing/Reply to my route.vue'), children: [{path: '/', component: ()=> import('../components/Message routing/All_replies.vue')}]},
        {path: '/reply to my route', component: ()=> import('../components/Message routing/Reply to my route.vue'), children: [
          {path: '/', component: ()=> import('../components/Message routing/All_replies.vue')},
          {path: '/all_replies', component: ()=> import('../components/Message routing/All_replies.vue')},
          {path: '/what_I_care_about', component: ()=> import('../components/Message routing/What_I_care_about.vue')}
        ]},
        {path: '/active me routing', component: ()=> import('../components/Message routing/Active me routing.vue'), children: [
          {path: '/', component: ()=> import('../components/Message routing/All_replies2.vue')},
          {path: '/all_replies2', component: ()=> import('../components/Message routing/All_replies2.vue')},
          {path: '/what_I_care_about2', component: ()=> import('../components/Message routing/What_I_care_about2.vue')}
        ]},
        {path: '/system notification routing', component: ()=> import('../components/Message routing/System notification routing.vue')},
        {path: '/route received', component: ()=> import('../components/Message routing/Route received.vue'), children: [
          {path: '/', component: ()=> import('../components/Message routing/All_replies3.vue')},
          {path: '/all_replies3', component: ()=> import('../components/Message routing/All_replies3.vue')},
          {path: '/what_I_care_about3', component: ()=> import('../components/Message routing/What_I_care_about3.vue')}
        ]},
        {path: '/message_settings', component: ()=> import('../components/News/Message_settings.vue')}
      ]},
      
      // {path: '/post', component: Post},
      // {path: '/publish', component: Publish}
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
